home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / lynx-2.4 / WWW / Library / Implementation / HTParse.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-28  |  3.8 KB  |  157 lines

  1. /*                                                   HTParse:  URL parsing in the WWW Library
  2.                                          HTPARSE
  3.                                              
  4.    This module of the WWW library contains code to parse URLs and various related things.
  5.    Implemented by HTParse.c .
  6.    
  7.  */
  8. #ifndef HTPARSE_H
  9. #define HTPARSE_H
  10.  
  11. #ifndef HTUTILS_H
  12. #include "HTUtils.h"
  13. #endif /* HTUTILS_H */
  14.  
  15. /*
  16.  
  17.    The following are flag bits which may be ORed together to form a number to give the
  18.    'wanted' argument to HTParse.
  19.    
  20.  */
  21. #define PARSE_ACCESS            16
  22. #define PARSE_HOST               8
  23. #define PARSE_PATH               4
  24. #define PARSE_ANCHOR             2
  25. #define PARSE_PUNCTUATION        1
  26. #define PARSE_ALL               31
  27.  
  28.  
  29. /*
  30.  
  31. HTParse:  Parse a URL relative to another URL
  32.  
  33.    This returns those parts of a name which are given (and requested) substituting bits
  34.    from the related name where necessary.
  35.    
  36.   ON ENTRY
  37.   
  38.   aName                   A filename given
  39.                          
  40.   relatedName             A name relative to which aName is to be parsed
  41.                          
  42.   wanted                  A mask for the bits which are wanted.
  43.                          
  44.   ON EXIT,
  45.   
  46.   returns                 A pointer to a malloc'd string which MUST BE FREED
  47.                          
  48.  */
  49.  
  50. extern char * HTParse  PARAMS((const char * aName, const char * relatedName, int wanted));
  51.  
  52.  
  53. /*
  54.  
  55. HTStrip: Strip white space off a string
  56.  
  57.   ON EXIT
  58.   
  59.    Return value points to first non-white character, or to 0 if none.
  60.    
  61.    All trailing white space is OVERWRITTEN with zero.
  62.    
  63.  */
  64. #ifdef __STDC__
  65. extern char * HTStrip(char * s);
  66. #else
  67. extern char * HTStrip();
  68. #endif
  69.  
  70. /*
  71.  
  72. HTSimplify: Simplify a UTL
  73.  
  74.    A URL is allowed to contain the seqeunce xxx/../ which may be replaced by "" , and the
  75.    seqeunce "/./" which may be replaced by "/". Simplification helps us recognize
  76.    duplicate filenames. It doesn't deal with soft links, though. The new (shorter)
  77.    filename overwrites the old.
  78.    
  79.  */
  80. /*
  81. **      Thus,   /etc/junk/../fred       becomes /etc/fred
  82. **              /etc/junk/./fred        becomes /etc/junk/fred
  83. */
  84. #ifdef __STDC__
  85. extern void HTSimplify(char * filename);
  86. #else
  87. extern void HTSimplify();
  88. #endif
  89.  
  90.  
  91. /*
  92.  
  93. HTRelative:  Make Relative (Partial) URL
  94.  
  95.    This function creates and returns a string which gives an expression of one address as
  96.    related to another. Where there is no relation, an absolute address is retured.
  97.    
  98.   ON ENTRY,
  99.   
  100.    Both names must be absolute, fully qualified names of nodes (no anchor bits)
  101.    
  102.   ON EXIT,
  103.   
  104.    The return result points to a newly allocated name which, if parsed by HTParse relative
  105.    to relatedName, will yield aName. The caller is responsible for freeing the resulting
  106.    name later.
  107.    
  108.  */
  109. #ifdef __STDC__
  110. extern char * HTRelative(const char * aName, const char *relatedName);
  111. #else
  112. extern char * HTRelative();
  113. #endif
  114.  
  115.  
  116. /*
  117.  
  118. HTEscape:  Encode unacceptable characters in string
  119.  
  120.    This funtion takes a string containing any sequence of ASCII characters, and returns a
  121.    malloced string containing the same infromation but with all "unacceptable" characters
  122.    represented in the form %xy where X and Y are two hex digits.
  123.    
  124.  */
  125. extern char * HTEscape PARAMS((CONST char * str, unsigned char mask));
  126.  
  127. /*
  128.  
  129.    The following are valid mask values. The terms are the BNF names in the URL document.
  130.    
  131.  */
  132. #define URL_XALPHAS     (unsigned char) 1
  133. #define URL_XPALPHAS    (unsigned char) 2
  134. #define URL_PATH        (unsigned char) 4
  135.  
  136.  
  137. /*
  138.  
  139. HTUnEscape: Decode %xx escaped characters
  140.  
  141.    This function takes a pointer to a string in which character smay have been encoded in
  142.    %xy form, where xy is the acsii hex code for character 16x+y. The string is converted
  143.    in place, as it will never grow.
  144.    
  145.  */
  146. extern char * HTUnEscape PARAMS(( char * str));
  147.  
  148.  
  149. #endif  /* HTPARSE_H */
  150.  
  151.  
  152. /*
  153.  
  154.    end of HTParse
  155.    
  156.     */
  157.